import { useCallback } from 'react';
import useBasisCash from './useBasisCash';
import useHandleTransactionReceipt from './useHandleTransactionReceipt';
import BasisCash, { Bank } from '../basis-cash';
import { TransactionResponse } from '@ethersproject/providers';
import { BigNumber } from '@ethersproject/bignumber';
import { parseUnits } from 'ethers/lib/utils';

const useBuyFishCard = (pool: string, basisCash: BasisCash, handleTransactionReceipt: (
  promise: Promise<TransactionResponse>,
  summary: string,
) => void) => {
  
  const handleReward = useCallback((idx: number) => {
    const idxBn = BigNumber.from(idx);
    handleTransactionReceipt(
      basisCash.buyFishCard(pool, idxBn),
      `buyFishCard from ${pool}`,
    );
  }, [pool, basisCash]);

  return { onBuyFishCard: handleReward };
};

export default useBuyFishCard;
